package net.xiaoyu233.mitemod.miteite.network;

import net.minecraft.Connection;
import net.minecraft.Packet;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class SPacketSyncGolemGrowth extends Packet {

    private int entityId;
    private int level;
    private int experience;
    private int nextLevelExp;
    private float health;
    private float maxHealth;
    private float attackDamage;

    public SPacketSyncGolemGrowth() {}

    public SPacketSyncGolemGrowth(int entityId, int level, int experience, int nextLevelExp,
                                  float health, float maxHealth, float attackDamage) {
        this.entityId = entityId;
        this.level = level;
        this.experience = experience;
        this.nextLevelExp = nextLevelExp;
        this.health = health;
        this.maxHealth = maxHealth;
        this.attackDamage = attackDamage;
    }
    @Override
    public void readPacketData(DataInput dataInput) throws IOException {
        this.entityId = dataInput.readInt();
        this.level = dataInput.readInt();
        this.experience = dataInput.readInt();
        this.nextLevelExp = dataInput.readInt();
        this.health = dataInput.readFloat();
        this.maxHealth = dataInput.readFloat();
        this.attackDamage = dataInput.readFloat();
    }

    @Override
    public void writePacketData(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(this.entityId);
        dataOutput.writeInt(this.level);
        dataOutput.writeInt(this.experience);
        dataOutput.writeInt(this.nextLevelExp);
        dataOutput.writeFloat(this.health);
        dataOutput.writeFloat(this.maxHealth);
        dataOutput.writeFloat(this.attackDamage);
    }

    @Override
    public void processPacket(Connection connection) {

    }

    @Override
    public int getPacketSize() {
        return 31;
    }

    public int getEntityId() { return entityId; }
    public int getLevel() { return level; }
    public int getExperience() { return experience; }
    public int getNextLevelExp() { return nextLevelExp; }
    public float getHealth() { return health; }
    public float getMaxHealth() { return maxHealth; }
    public float getAttackDamage() { return attackDamage; }
}
